package com.lw.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;


/**
 *  表定义层。
 *
 * @author lw
 * @since 2025年04月29日 11:35:15
 */
public class TbAlarmTableDef extends TableDef {

    private static final long serialVersionUID = 1L;

    /**
     * 
     */
    public static final TbAlarmTableDef TB_ALARM = new TbAlarmTableDef();

    
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 编码
     */
    public final QueryColumn CODE = new QueryColumn(this, "code");

    /**
     * 告警名称
     */
    public final QueryColumn NAME = new QueryColumn(this, "name");

    /**
     * 类型
     */
    public final QueryColumn TYPE = new QueryColumn(this, "type");

    /**
     * 等级：danger，warning，info
     */
    public final QueryColumn LEVEL = new QueryColumn(this, "level");

    /**
     * 状态
     */
    public final QueryColumn STATUS = new QueryColumn(this, "status");

    /**
     * 告警时间
     */
    public final QueryColumn ALARM_TIME = new QueryColumn(this, "alarm_time");

    /**
     * 状态码
     */
    public final QueryColumn STATUS_CODE = new QueryColumn(this, "status_code");

    /**
     * 告警详情
     */
    public final QueryColumn ALARM_DETAIL = new QueryColumn(this, "alarm_detail");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, NAME, CODE, TYPE, LEVEL, STATUS_CODE, ALARM_TIME, ALARM_DETAIL, STATUS};

    public TbAlarmTableDef() {
        super("", "tb_alarm");
    }

    private TbAlarmTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public TbAlarmTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new TbAlarmTableDef("", "tb_alarm", alias));
    }

}
